import {createRouter, createWebHistory} from 'vue-router'

import LoginVue from "@/views/Login.vue";
import LayoutVue from "@/views/Layout.vue";
import ArticleCategoryVue from "@/views/article/ArticleCategory.vue";
import ArticleManageVue from "@/views/article/ArticleManage.vue";
import UserResetPasswordVue from "@/views/user/UserResetPassword.vue";
import UserManageVue from "@/views/user/UserManage.vue";
import PlaceListVue from "@/views/places/PlaceList.vue";
import Home from "@/views/discard/home.vue";
import ControllerVue from "@/views/discard/controller.vue";
import Analysis from "@/views/discard/analysis.vue";
import UserPowerVue from "@/views/user/UserPower.vue";
import UserComment from "@/views/comment/UserComment.vue";
import LoginLogVue from "@/views/system/Loginlog.vue";
import ArticleInspect from "@/views/article/ArticleInspect.vue";
import CategoryInspect from "@/views/article/CategoryInspect.vue";
import Notice from '@/views/message/notice.vue'
import Feedback from '@/views/message/feedback.vue'
import Msg from '@/views/message/msg.vue'
import ArticleComment from "@/views/comment/ArticleComment.vue";
import PlaceComment from "@/views/comment/PlaceComment.vue";


//定义路由
const routes = [
    {
        path: '/',
        name: 'Login',
        component: LoginVue
    },
    {
        path: '/login',
        component: LoginVue
    },
    {
        path: '/layout',
        name: 'Layout',
        component: LayoutVue,
        children: [
            { path:'', redirect: '/other/home'}, //默认加载
            { path: '/other/home', component: Home}, //首页
            { path: '/other/controller', component: ControllerVue}, //控制台
            { path: '/other/analysis', component: Analysis}, //分析

            { path: '/article/category', component: ArticleCategoryVue }, //文章分类
            { path: '/article/manage', component: ArticleManageVue }, //文章管理
            { path: '/article/inspect', component: ArticleInspect }, //文章审核
            { path: '/category/inspect', component: CategoryInspect }, //分类审核

            { path: '/user/power', component: UserPowerVue}, //用户头像
            { path: '/user/resetPassword', component: UserResetPasswordVue}, //重置密码
            { path: '/user/manage', component: UserManageVue}, //用户管理
            { path: '/place/list', component: PlaceListVue},//地点管理

            { path: '/comment/userComment', component:UserComment }, //用户评论
            { path: '/comment/articleComment', component: ArticleComment}, //文章评论
            { path: '/comment/placeComment', component: PlaceComment }, //地点评论

            { path: '/message/notice', component: Notice },
            { path: '/message/feedback', component: Feedback },
            { path: '/message/msg',component: Msg},

            { path: '/system/loginlog', component: LoginLogVue }
        ]
    }
]

//创建路由
const router = createRouter({
    history: createWebHistory(),
    routes: routes
})

//导出路由
export default router